﻿
namespace bookMaster.AssetSystem.Windows.Forms
{
	/// <summary>
	/// This is the abstract edit form for the <see cref="Entities.Recursos"/> entity.
	/// </summary>
	/// <remarks>This class is overwritten by .netTiers at each generation.</remarks>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class RecursosEditControlBase : System.Windows.Forms.UserControl
	{
		#region Fields
		
		//private System.Windows.Forms.TableLayoutPanel uxTableLayoutPanel;
		/// <summary>
		/// The ErrorProvider for the Entity;
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxErrorProvider;
		
		/// <summary>
		/// The BindingSource for the entity.
		///</summary>
		protected System.Windows.Forms.BindingSource uxBindingSource;
						
		
		/// <summary>
		/// TextBox for the IdRecurso property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxIdRecurso;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the IdRecurso property.
		/// </summary>
		protected System.Windows.Forms.Label uxIdRecursoLabel;
		
		/// <summary>
		/// TextBox for the LlaveRecurso property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxLlaveRecurso;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the LlaveRecurso property.
		/// </summary>
		protected System.Windows.Forms.Label uxLlaveRecursoLabel;
		
		/// <summary>
		/// TextBox for the NombreRecurso property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxNombreRecurso;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the NombreRecurso property.
		/// </summary>
		protected System.Windows.Forms.Label uxNombreRecursoLabel;
		
		/// <summary>
		/// TextBox for the DescripcionRecurso property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxDescripcionRecurso;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the DescripcionRecurso property.
		/// </summary>
		protected System.Windows.Forms.Label uxDescripcionRecursoLabel;
		
		/// <summary>
		/// ComboBox for the TipoRecurso property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxTipoRecurso;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the TipoRecurso property.
		/// </summary>
		protected System.Windows.Forms.Label uxTipoRecursoLabel;
		
		/// <summary>
		/// TextBox for the PadreRecurso property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxPadreRecurso;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the PadreRecurso property.
		/// </summary>
		protected System.Windows.Forms.Label uxPadreRecursoLabel;
		#endregion
		
		#region Main entity
		private Entities.Recursos _Recursos;
		/// <summary>
		/// Gets or sets the <see cref="Entities.Recursos"/> entity to edit with this form.
		/// </summary>
		/// <value>The <see cref="Entities.Recursos"/> instance.</value>
		public Entities.Recursos Recursos
		{
			get {return this._Recursos;}
			set
			{
				this._Recursos = value;
				if (value != null) 
				{
					this.uxBindingSource.DataSource = value;
					BindControls();
				}			
				
			}
		}
		#endregion
		
		/// <summary>
		/// Binds the controls.
		/// </summary>
		private void BindControls()
		{
			this.uxIdRecurso.DataBindings.Clear();
			this.uxIdRecurso.DataBindings.Add("Text", this.uxBindingSource, "IdRecurso", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxLlaveRecurso.DataBindings.Clear();
			this.uxLlaveRecurso.DataBindings.Add("Text", this.uxBindingSource, "LlaveRecurso", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxNombreRecurso.DataBindings.Clear();
			this.uxNombreRecurso.DataBindings.Add("Text", this.uxBindingSource, "NombreRecurso", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxDescripcionRecurso.DataBindings.Clear();
			this.uxDescripcionRecurso.DataBindings.Add("Text", this.uxBindingSource, "DescripcionRecurso", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxTipoRecurso.DataBindings.Clear();
			this.uxTipoRecurso.DataBindings.Add("SelectedValue", this.uxBindingSource, "TipoRecurso", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxPadreRecurso.DataBindings.Clear();
			this.uxPadreRecurso.DataBindings.Add("Text", this.uxBindingSource, "PadreRecurso", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
		}					
		
		#region Constructor
		
		/// <summary>
		/// Initializes a new instance of the <see cref="RecursosEditControlBase"/> class.
		/// </summary>
		public RecursosEditControlBase()
		{
			InitializeComponent();			
			
			this.uxBindingSource.CurrentItemChanged += new System.EventHandler(uxBindingSource_currentItemChanged);
		}		
		
		/// <summary>
		/// 
		/// </summary>
		private void uxBindingSource_currentItemChanged(object sender, System.EventArgs e)
		{
			if (_Recursos != null) _Recursos.Validate();
		}	
				
		/// <summary>
		/// Initializes the component.
		/// </summary>
		public void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			this.uxErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxBindingSource = new System.Windows.Forms.BindingSource(this.components);
			
			//this.uxTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
			this.uxIdRecurso = new System.Windows.Forms.TextBox();
			uxIdRecursoLabel = new System.Windows.Forms.Label();
			this.uxLlaveRecurso = new System.Windows.Forms.TextBox();
			uxLlaveRecursoLabel = new System.Windows.Forms.Label();
			this.uxNombreRecurso = new System.Windows.Forms.TextBox();
			uxNombreRecursoLabel = new System.Windows.Forms.Label();
			this.uxDescripcionRecurso = new System.Windows.Forms.TextBox();
			uxDescripcionRecursoLabel = new System.Windows.Forms.Label();
			this.uxTipoRecurso = new System.Windows.Forms.ComboBox();
			uxTipoRecursoLabel = new System.Windows.Forms.Label();
			this.uxPadreRecurso = new System.Windows.Forms.TextBox();
			uxPadreRecursoLabel = new System.Windows.Forms.Label();
			
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).BeginInit();
			this.SuspendLayout();
			
			// 
			// uxTableLayoutPanel
			// 
			//this.uxTableLayoutPanel.AutoSize = true;
			//this.uxTableLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
			//this.uxTableLayoutPanel.ColumnCount = 2;
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 120F));
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 250F));
			//this.uxTableLayoutPanel.Location = new System.Drawing.System.Drawing.Point(3, 3);
			//this.uxTableLayoutPanel.Name = "uxTableLayoutPanel";
			//this.uxTableLayoutPanel.RowCount = 2;
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.Size = new System.Drawing.Size(450, 50);
			//this.uxTableLayoutPanel.TabIndex = 0;
			
			//
			// uxErrorProvider
			//
			this.uxErrorProvider.ContainerControl = this;
			this.uxErrorProvider.DataSource = this.uxBindingSource;
			
			//
			// uxIdRecursoLabel
			//
			this.uxIdRecursoLabel.Name = "uxIdRecursoLabel";
			this.uxIdRecursoLabel.Text = "Id Recurso:";
			this.uxIdRecursoLabel.Location = new System.Drawing.Point(3, 0);
			this.Controls.Add(this.uxIdRecursoLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxIdRecursoLabel);			
			//
			// uxIdRecurso
			//
			this.uxIdRecurso.Name = "uxIdRecurso";
			this.uxIdRecurso.ReadOnly = true;
			//this.uxTableLayoutPanel.Controls.Add(this.uxIdRecurso);
			this.uxIdRecurso.Location = new System.Drawing.Point(160, 0);
			this.Controls.Add(this.uxIdRecurso);
			//
			// uxLlaveRecursoLabel
			//
			this.uxLlaveRecursoLabel.Name = "uxLlaveRecursoLabel";
			this.uxLlaveRecursoLabel.Text = "Llave Recurso:";
			this.uxLlaveRecursoLabel.Location = new System.Drawing.Point(3, 26);
			this.Controls.Add(this.uxLlaveRecursoLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxLlaveRecursoLabel);			
			//
			// uxLlaveRecurso
			//
			this.uxLlaveRecurso.Name = "uxLlaveRecurso";
			this.uxLlaveRecurso.Width = 250;
			this.uxLlaveRecurso.MaxLength = 50;
			//this.uxTableLayoutPanel.Controls.Add(this.uxLlaveRecurso);
			this.uxLlaveRecurso.Location = new System.Drawing.Point(160, 26);
			this.Controls.Add(this.uxLlaveRecurso);
			//
			// uxNombreRecursoLabel
			//
			this.uxNombreRecursoLabel.Name = "uxNombreRecursoLabel";
			this.uxNombreRecursoLabel.Text = "Nombre Recurso:";
			this.uxNombreRecursoLabel.Location = new System.Drawing.Point(3, 52);
			this.Controls.Add(this.uxNombreRecursoLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxNombreRecursoLabel);			
			//
			// uxNombreRecurso
			//
			this.uxNombreRecurso.Name = "uxNombreRecurso";
			this.uxNombreRecurso.Width = 250;
			this.uxNombreRecurso.MaxLength = 200;
			//this.uxTableLayoutPanel.Controls.Add(this.uxNombreRecurso);
			this.uxNombreRecurso.Location = new System.Drawing.Point(160, 52);
			this.Controls.Add(this.uxNombreRecurso);
			//
			// uxDescripcionRecursoLabel
			//
			this.uxDescripcionRecursoLabel.Name = "uxDescripcionRecursoLabel";
			this.uxDescripcionRecursoLabel.Text = "Descripcion Recurso:";
			this.uxDescripcionRecursoLabel.Location = new System.Drawing.Point(3, 78);
			this.Controls.Add(this.uxDescripcionRecursoLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxDescripcionRecursoLabel);			
			//
			// uxDescripcionRecurso
			//
			this.uxDescripcionRecurso.Name = "uxDescripcionRecurso";
			this.uxDescripcionRecurso.Width = 250;
			this.uxDescripcionRecurso.MaxLength = 200;
			//this.uxTableLayoutPanel.Controls.Add(this.uxDescripcionRecurso);
			this.uxDescripcionRecurso.Location = new System.Drawing.Point(160, 78);
			this.Controls.Add(this.uxDescripcionRecurso);
			//
			// uxTipoRecursoLabel
			//
			this.uxTipoRecursoLabel.Name = "uxTipoRecursoLabel";
			this.uxTipoRecursoLabel.Text = "Tipo Recurso:";
			this.uxTipoRecursoLabel.Location = new System.Drawing.Point(3, 104);
			this.Controls.Add(this.uxTipoRecursoLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxTipoRecursoLabel);			
			//
			// uxTipoRecurso
			//
			this.uxTipoRecurso.Name = "uxTipoRecurso";
			//this.uxTableLayoutPanel.Controls.Add(this.uxTipoRecurso);
			this.uxTipoRecurso.Location = new System.Drawing.Point(160, 104);
			this.Controls.Add(this.uxTipoRecurso);
			//
			// uxPadreRecursoLabel
			//
			this.uxPadreRecursoLabel.Name = "uxPadreRecursoLabel";
			this.uxPadreRecursoLabel.Text = "Padre Recurso:";
			this.uxPadreRecursoLabel.Location = new System.Drawing.Point(3, 130);
			this.Controls.Add(this.uxPadreRecursoLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxPadreRecursoLabel);			
			//
			// uxPadreRecurso
			//
			this.uxPadreRecurso.Name = "uxPadreRecurso";
			this.uxPadreRecurso.Width = 250;
			this.uxPadreRecurso.MaxLength = 50;
			//this.uxTableLayoutPanel.Controls.Add(this.uxPadreRecurso);
			this.uxPadreRecurso.Location = new System.Drawing.Point(160, 130);
			this.Controls.Add(this.uxPadreRecurso);
			//
			// uxTipoRecurso
			//				
			this.uxTipoRecurso.DisplayMember = "DescripcionTipoRecurso";	
			this.uxTipoRecurso.ValueMember = "TipoRecurso";	
			// 
			// RecursosEditControlBase
			// 
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			//this.Controls.Add(this.uxTableLayoutPanel);
			this.AutoScroll = true;
			this.Name = "RecursosEditControlBase";
			this.Size = new System.Drawing.Size(478, 311);
			//this.Localizable = true;
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).EndInit();			
			this.ResumeLayout(false);
			this.PerformLayout();
		}
		#endregion
				
		#region ComboBox List
		
				
		private Entities.TList<Entities.TiposRecursos> _TipoRecursoList;
		
		/// <summary>
		/// The ComboBox associated with the TipoRecurso property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.TiposRecursos> TipoRecursoList
		{
			get {return _TipoRecursoList;}
			set 
			{
				this._TipoRecursoList = value;
				this.uxTipoRecurso.DataSource = null;
				this.uxTipoRecurso.DataSource = value;
			}
		}
		
		private bool _allowNewItemInTipoRecursoList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the TipoRecurso property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInTipoRecursoList
		{
			get { return _allowNewItemInTipoRecursoList;}
			set
			{
				this._allowNewItemInTipoRecursoList = value;
				this.uxTipoRecurso.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
		
		#endregion
		
        #region Field visibility

        /// <summary>
        /// Indicates if the controls associated with the uxIdRecurso property should be visible.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Visible property for related controls.")]
        public bool uxIdRecursoVisible
        {
            get { return this.uxIdRecurso.Visible; }
            set
            {
                this.uxIdRecursoLabel.Visible = value;
                this.uxIdRecurso.Visible = value;
            }
        }

        /// <summary>
        /// Indicates if the controls associated with the uxIdRecurso property should be enabled.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Enabled property for related controls.")]
        public bool uxIdRecursoEnabled
        {
            get { return this.uxIdRecurso.Enabled; }
            set
            {
                this.uxIdRecurso.Enabled = value;
            }
        }
        /// <summary>
        /// Indicates if the controls associated with the uxLlaveRecurso property should be visible.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Visible property for related controls.")]
        public bool uxLlaveRecursoVisible
        {
            get { return this.uxLlaveRecurso.Visible; }
            set
            {
                this.uxLlaveRecursoLabel.Visible = value;
                this.uxLlaveRecurso.Visible = value;
            }
        }

        /// <summary>
        /// Indicates if the controls associated with the uxLlaveRecurso property should be enabled.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Enabled property for related controls.")]
        public bool uxLlaveRecursoEnabled
        {
            get { return this.uxLlaveRecurso.Enabled; }
            set
            {
                this.uxLlaveRecurso.Enabled = value;
            }
        }
        /// <summary>
        /// Indicates if the controls associated with the uxNombreRecurso property should be visible.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Visible property for related controls.")]
        public bool uxNombreRecursoVisible
        {
            get { return this.uxNombreRecurso.Visible; }
            set
            {
                this.uxNombreRecursoLabel.Visible = value;
                this.uxNombreRecurso.Visible = value;
            }
        }

        /// <summary>
        /// Indicates if the controls associated with the uxNombreRecurso property should be enabled.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Enabled property for related controls.")]
        public bool uxNombreRecursoEnabled
        {
            get { return this.uxNombreRecurso.Enabled; }
            set
            {
                this.uxNombreRecurso.Enabled = value;
            }
        }
        /// <summary>
        /// Indicates if the controls associated with the uxDescripcionRecurso property should be visible.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Visible property for related controls.")]
        public bool uxDescripcionRecursoVisible
        {
            get { return this.uxDescripcionRecurso.Visible; }
            set
            {
                this.uxDescripcionRecursoLabel.Visible = value;
                this.uxDescripcionRecurso.Visible = value;
            }
        }

        /// <summary>
        /// Indicates if the controls associated with the uxDescripcionRecurso property should be enabled.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Enabled property for related controls.")]
        public bool uxDescripcionRecursoEnabled
        {
            get { return this.uxDescripcionRecurso.Enabled; }
            set
            {
                this.uxDescripcionRecurso.Enabled = value;
            }
        }
        /// <summary>
        /// Indicates if the controls associated with the uxTipoRecurso property should be visible.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Visible property for related controls.")]
        public bool uxTipoRecursoVisible
        {
            get { return this.uxTipoRecurso.Visible; }
            set
            {
                this.uxTipoRecursoLabel.Visible = value;
                this.uxTipoRecurso.Visible = value;
            }
        }

        /// <summary>
        /// Indicates if the controls associated with the uxTipoRecurso property should be enabled.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Enabled property for related controls.")]
        public bool uxTipoRecursoEnabled
        {
            get { return this.uxTipoRecurso.Enabled; }
            set
            {
                this.uxTipoRecurso.Enabled = value;
            }
        }
        /// <summary>
        /// Indicates if the controls associated with the uxPadreRecurso property should be visible.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Visible property for related controls.")]
        public bool uxPadreRecursoVisible
        {
            get { return this.uxPadreRecurso.Visible; }
            set
            {
                this.uxPadreRecursoLabel.Visible = value;
                this.uxPadreRecurso.Visible = value;
            }
        }

        /// <summary>
        /// Indicates if the controls associated with the uxPadreRecurso property should be enabled.
        /// </summary>
        [System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Set Enabled property for related controls.")]
        public bool uxPadreRecursoEnabled
        {
            get { return this.uxPadreRecurso.Enabled; }
            set
            {
                this.uxPadreRecurso.Enabled = value;
            }
        }

        #endregion

		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;

		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	}
}
